package com.fanketly.musicdiary.data.db

import androidx.room.*
import com.fanketly.musicdiary.data.model.DiaryModel
import kotlinx.coroutines.flow.Flow

@Dao
interface DiaryDao {
    @Query("select * from diary")
    fun getAll(): Flow<List<DiaryModel>>

//    @Query("select * from diary where year=:year and month=:month and dayOfMonth=:dayOfMonth")
//    fun queryByDate(year: Int, month: Int, dayOfMonth: Int): Flow<DiaryModel?>

//    @Query("select * from diary where year=:year ")
//    fun queryByYear(year: Int): Flow<List<DiaryModel>>

    @Insert(onConflict = OnConflictStrategy.IGNORE)
    suspend fun insert(diaryModel: DiaryModel): Long

    @Update
    suspend fun update(diaryModel: DiaryModel): Int

//    @Update
//    suspend fun update(diaryModels: List<DiaryModel>)

//    @Delete
//    fun delete(safeUrlModel: SafePhotoSortModel): Int
}
